﻿using UnityEngine;
using System.Collections;

public class MouseDetector : MonoBehaviour {

	public GameObject[] interactiveObjects;

	// Use this for initialization
	void Start () {
		Dialoguer.events.onTextPhase += OnTextPhase;
	}

	void OnTextPhase (DialoguerTextData data)
	{
		Debug.Log (data.name + ": " + data.text);
	}
	
	// Update is called once per frame
	void Update () {
		if(gameObject.activeSelf)
		{
			interactiveObjects = GameObject.FindGameObjectsWithTag("Hotspots");
			for(int i = 0; i < interactiveObjects.Length; i++)
				interactiveObjects[i].layer = 2; //changes every interactive Object to "Ignore Raycast"
		}

		if(Input.GetMouseButtonDown(0))
			Debug.Log("Click!");
	}

	void OnMouseDown(){ //still doesn't work after moving all hotspots in the Ignore Raycast Layer. - Thad
		Debug.Log("Clicked the wall!");
		//Dialoguer.ContinueDialogue ();
	}
}
